/*
 * The MIT License
 *
 * Copyright 2012 Anonymous.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package pentomino.ui;

import java.awt.Color;
import pentomino.logic.Figure;

/**
 *
 * Represents an help constans and methods for figure visualization.
 */
public class InterfaceHelper {
    
    // Orientation constants:
    public static int LEFT = 1;
    public static int RIGHT = 2;
    public static int TOP = 4;
    public static int BOTTOM = 8;
    
    // Color constants:
    
    public static Color F_COLOR = new Color(0xFFFF3D);
    public static Color I_COLOR = new Color(0x0026FF);
    public static Color L_COLOR = new Color(0xB200FF);
    public static Color N_COLOR = new Color(0x0094FF);
    public static Color P_COLOR = new Color(0x4CFF00);
    public static Color T_COLOR = new Color(0x0094FF);
    public static Color U_COLOR = new Color(0xFF6A00);
    public static Color V_COLOR = new Color(0xB6FF00);
    public static Color W_COLOR = new Color(0x62B207);
    public static Color X_COLOR = new Color(0xFF0000);
    public static Color Y_COLOR = new Color(0x4800FF);
    public static Color Z_COLOR = new Color(0xFF6068);
    
    public static Color BORDER_COLOR = Color.LIGHT_GRAY;
    public static Color EMPTY_COLOR = new Color(Color.OPAQUE, true);
    public static Color INVALID_COLOR = new Color(0xCCCCCC);
    public static Color SELECTION_COLOR = new Color(0x0099CC);
    public static Color SELECTION_BORDER_COLOR = new Color(0x0033CC);
    
    /**
     * Gets a corresponding color for the specified figure.
     * 
     * @param source a game figure
     * @return a game figure base color
     */
    public static Color getFigureColor(Figure source)
    {
        return getFigureColor(source.getType());
    }
    
    /**
     * Gets a corresponding color for the specified figure type.
     * 
     * @param source a game figure type
     * @return a game figure base color
     */
    public static Color getFigureColor(char source)
    {
        switch(source)
        {
            case 'F':
                return F_COLOR;
            case 'I':
                return I_COLOR;
            case 'L':
                return L_COLOR;
            case 'N':
                return N_COLOR;
            case 'P':
                return P_COLOR;
            case 'T':
                return T_COLOR;
            case 'U':
                return U_COLOR;
            case 'V':
                return V_COLOR;
            case 'W':
                return W_COLOR;
            case 'X':
                return X_COLOR;
            case 'Y':
                return Y_COLOR;
            case 'Z':
                return Z_COLOR;
            case '0':
                return EMPTY_COLOR;
            default:
                return INVALID_COLOR;
        }
    }
}
